<template>
  <view class="categoryPage">
    <topBar></topBar>
    <div class="part11-empty" v-if="!list.length">
      <div>
        <img class="part11-empty1" src="../../assets/img/empty.png" alt="" />
        <p>正在开发中，敬请期待</p>
      </div>
    </div>
    <div class="part1">
      <div class="part1-list">
        <div class="part11" v-for="(item, index) in list" :key="index" @click="jumpPage(item)">
          <image class="part11Img" :src="item.img" mode="aspectFill"></image>
          <div class="part11Txt">{{ item.name }}</div>
        </div>
      </div>
    </div>
  </view>
</template>

<script>
import { gameList } from './data1'

export default {
  data() {
    return {
      tabsNum: null,
      list: [],
      list1: gameList,
      qPage: null,
    }
  },
  onLoad(i) {
    this.qPage = i
  },
  mounted() {
    this.tabsNum = this.qPage.tabs
    uni.setNavigationBarTitle({
      title: this.qPage.title || '分类',
    })
    if (this.qPage.tabs.includes('A')) {
      this.list = this.list1.filter((v1) => {
        if (this.tabsNum == 'A8') {
          if (v1.tabs.includes('A')) {
            return v1
          }
        } else if (v1.tabs.includes(this.tabsNum)) {
          return v1
        }
      })
    }
    if (this.qPage.tabs.includes('B')) {
      this.list = this.list1.filter((v1) => {
        if (this.tabsNum == 'B8') {
          if (v1.tabs.includes('B')) {
            return v1
          }
        } else if (v1.tabs.includes(this.tabsNum)) {
          return v1
        }
      })
    }
  },
  methods: {
    jumpPage(i) {
      if (i.route) {
        uni.navigateTo({
          url: i.route,
        })
      } else {
        location.href = 'https://game.jszechao.com' + i.route1
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.categoryPage {
  min-height: 100vh;
  background: #f9f9f9;
  .part11-empty {
    height: calc(100vh - 110rpx);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #898b8d;
    font-size: 26rpx;
    line-height: 37rpx;
    .part11-empty1 {
      margin-bottom: 53rpx;
      width: 423rpx;
      height: 323rpx;
      animation: move1 infinite 2s;
    }
    @keyframes move1 {
      0% {
        transform: translateY(0);
      }
      50% {
        transform: translateY(-10px);
      }
      100% {
        transform: translateY(0);
      }
    }
  }
  .part1 {
    padding: 100rpx 30rpx 0;
    .part1-list {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
    }
    .part11Img {
      width: 330rpx;
      height: 330rpx;
      border-radius: 18rpx;
      display: block;
    }
    .part11 {
      background: #fff;
      width: 330rpx;
      margin-bottom: 30rpx;
      text-align: center;
      border-radius: 16rpx;
      box-shadow: 0px 2rpx 14rpx 0px rgba(236, 239, 243, 0.91);
    }
    .part11Txt {
      font-size: 26rpx;
      line-height: 26rpx;
      padding: 30rpx 0;
    }
  }
}
</style>
